local ads__ruandan = fk.CreateSkill({
  name = "ads__ruandan",
})

ads__ruandan:addEffect(fk.Damage, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(ads__ruandan.name)
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    return room:askToSkillInvoke(player, {
      skill_name = ads__ruandan.name,
      data = data
    })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local from = data.from
    
    player:broadcastSkillInvoke(ads__ruandan.name)
    room:notifySkillInvoked(player, ads__ruandan.name, "control")
    
    if from and not from.dead then room:doIndicate(player.id, {from.id}) end
    local judge = {
      who = player,
      reason = ads__ruandan.name,
      pattern = ".|.|spade",
    }
    room:judge(judge)
    if judge:matchPattern() and from and not from.dead then
      local choice = room:askToChoice(player, {
        choices = {"ruandan_draw", "ruandan_damage"},
        skill_name = self.name
      })
      if choice == "ruandan_draw" then
        player:drawCards(2, ads__ruandan.name)
      else
        room:damage{
          from = player,
          to = from,
          damage = 1,
          skillName = ads__ruandan.name,
        }
      end
    end
  end,
})

Fk:loadTranslationTable{
  ["$ads__ruandan1"] = "鼠辈，竟敢伤我！",
  ["$ads__ruandan2"] = "以彼之道，还施彼身！",
  ["ads__ruandan"] = "软淡",
  [":ads__ruandan"] = "当一名角色造成伤害后，你可以进行判定：若结果为<font color='black'>♠</font>，则你选择一项：摸两张手牌，或对其造成1点伤害。",
  ["ruandan_draw"] = "你摸两张手牌",
  ["ruandan_damage"] = "对其造成1点伤害",
  ["#ruandan-choice"] = "软淡：请选择一项，对 %src 执行",
}


ads__ruandan:addAI({
  think_skill_invoke = Util.TrueFunc,
})


return ads__ruandan
